package com.tb.dubbo.controller;

import com.tb.dubbo.entity.User;
import com.tb.dubbo.service.UserService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 作者：tb
 * 描述：todo
 * 日期：Created in 2022/4/6 15:09
 *
 * @Version 1.0
 */
@Controller
@RequestMapping("user")
public class UserController {
    @Autowired
    private UserService userService;
    @RequestMapping("toIndex")
    public String toIndex(){
        return "index";
    }
    @RequestMapping("login")
    public String login(User user){
        User login = userService.login(user);
        if(login!=null){
            return "redirect:/book/list";
        }
        return "index";
    }
}
